<!DOCTYPE html>
<?php

if(isset($_COOKIE["userid"])){
    echo "cookie中的值：".$_COOKIE["userid"];
}else{
  //设置一个cookie  cookie中不能存放重要数据
setcookie("userid","中国人民万岁",time()+24*3600);  
}
//开启session
session_start();
if(isset($_SESSION["pagecount"])){
    $_SESSION["pagecount"]+=1;
    echo "<br/>session中的uid:".$_SESSION["pagecount"];
}else{
   $_SESSION["pagecount"]=1; 
}
echo "用户访问页面数量：".$_SESSION["pagecount"];

?>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <a href="demo006.php">demo006.php</a>
        <?php
        // put your code here
        ?>
    </body>
</html>
